﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Xml.Linq;

namespace Twi.COMMON.WPF
{
    /// <summary>
    /// CustomDataGrid_Style.xaml 的交互逻辑
    /// </summary>
    public partial class CustomDataGrid_Style : Window
    {
        public CustomDataGrid_Style()
        {
            InitializeComponent();
        }

        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void BtnSelAll_Click(object sender, RoutedEventArgs e)
        {
            XElement[] xeColunms = DgCustomColumns.Items.OfType<XElement>().ToArray();
            foreach (XElement item in xeColunms)
            {
                item.SetElementValue("Visibility", 0);
            }
        }

        private void BtnUnSelAll_Click(object sender, RoutedEventArgs e)
        {
            XElement[] xeColunms = DgCustomColumns.Items.OfType<XElement>().ToArray();
            foreach (XElement item in xeColunms)
            {
                item.SetElementValue("Visibility", 1);
            }
        }
    }
}
